//二分查找 迭代版
int binSearch(int *pa, int low, int high, int fdata)
{
    while(low <= high)
    {
        int mid = (low+high)/2;
        if(pa[mid] == fdata)
            return mid;
        else if(pa[mid] < fdata)
            low = mid+1;
        else if(pa[mid] > fdata)
            high = mid-1;
    }
    return -1;

}

//二分查找 递归版本
//返值格外注意 return 有无接收的

int binSearchRecur(int *pa, int low, int high, int fdata)
{
    if(low<=high)
    {
        int mid = (low+high)/2;
        if(pa[mid] == fdata)
            return mid;
        else if(pa[mid] < fdata)
            return binSearchRecur(pa,mid+1,high,fdata);
        else if(pa[mid] > fdata)
            return binSearchRecur(pa,low,mid-1,fdata);

    }
    else
        return -1;
}